﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace NuiDicomPlayer.Controls
{
    delegate void RiseTimerEvent();
    public class ZoneuserControl : NuiControl
    {
        Timer internal_timer;

       
        private void FireHandClickEvent()
        {
            RaiseEvent(new RoutedEventArgs(OnHandFiredEventRoutedEvent, this));
        }
        public  ZoneuserControl()
        {
            internal_timer = new Timer(50);
            internal_timer.Elapsed += internal_timer_Elapsed;
        }

        void internal_timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            this.Dispatcher.Invoke(new RiseTimerEvent(FireHandClickEvent)); 
        }
        public override void OnHandEnter(EventArgs eventArgs)
        {
            this.Background = new SolidColorBrush(EnterdBkg);
            internal_timer.Start();
            base.OnHandEnter(eventArgs);
        }
        public override void OnHandExit(EventArgs eventArgs)
        {
            this.Background = new SolidColorBrush(ExitedBkg);
            internal_timer.Stop();
            base.OnHandExit(eventArgs);
        }
        public override void OnHandIn(EventArgs eventArgs)
        {
            
            base.OnHandIn(eventArgs);
        }

       
    }
}
